import json
import os

from util.log import Log

def getConfigData(filename: str) -> dict:
    filepath = os.path.join(os.path.realpath(os.curdir), 'src', 'common', 'config', filename)

    with open(filepath, 'r', encoding='utf-8') as config_file:
        configdata = json.load(config_file)
        Log.debug(f'读取 {filename} 配置文件', configdata)

    return configdata


TORTOISE_ORM: dict = getConfigData('database_config.json')['TORTOISE_ORM']
REDIS_CONFIG: dict = getConfigData('redis_config.json')['REDIS_CONFIG']
WHITE_PATH: list = getConfigData('white_path.json')['WHITE_PATH']
